Apparatus for encoding and decoding image using adaptive DCT coefficient scanning based on pixel similarity and method therefor

ABSTRACT

The present invention discloses an encoding apparatus using a Discrete Cosine Transform (DCT) scanning, which includes a mode selection means for selecting an optimal mode for intra prediction; an intra prediction means for performing intra prediction onto video inputted based on the mode selected in the mode selection means; a DCT and quantization means for performing DCT and quantization onto residual coefficients of a block outputted from the intra prediction means; and an entropy encoding means for performing entropy encoding onto DCT coefficients acquired from the DCT and quantization by using a scanning mode decided based on pixel similarity of the residual coefficients.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of Application No. 12/377,617 having a 371(c) date of Feb. 16, 2009, now U.S. Pat. No. 8,548,060, which is a U.S. National Stage application of International Application No. PCT/KR2007/001433 filed on Mar. 23, 2007, which claims the benefit of Korean Application Nos. 10-2006-0077851 filed on Aug. 17, 2006, and 10-2007-0008247 filed on Jan. 26, 2007. The entire disclosures of Application No. 12/377,617, International Application No. PCT/KR2007/001433, and Korean Application Nos. 10-2006-0077851 and 10-2007-0008247 are incorporated herein by reference for all purposes.

TECHNICAL FIELD

The present invention relates to an encoding/decoding apparatus and method using an adaptive Discrete Cosine Transform (DCT) coefficient scanning based on pixel similarity. More particularly, the present invention relates to an encoding/decoding apparatus and method which performs intra prediction onto input video, predicts pixel similarity based on pixel similarity information of coefficients to be encoded that is acquired from adjacent pixels in the intra-predicted video, and performs a most effective scanning, e.g., Discrete Cosine Transform (DCT) coefficient scanning, according to the predicted pixel similarity.

BACKGROUND ART

According to video compression standards for encoding/decoding video data, a frame is divided into a plurality of macro blocks and a macro block may be divided into a plurality of sub-blocks. The encoding/decoding is performed on the basis of a macro block unit or a sub-block unit based on temporal prediction and spatial prediction.

Herein, the temporal prediction is to predict motion of macro blocks or sub-blocks of a current frame by referring to blocks of adjacent frames.

The spatial prediction is to predict motion of macro blocks or sub-blocks of a current frame to be encoded by using boundary pixels of already recovered adjacent blocks.

The spatial prediction is also called intra prediction. The intra prediction takes advantage of a characteristic that when a pixel is predicted, pixels adjacent to it are highly likely to have similar values.

H.264/Advanced Video Coding (AVC) standard technology can compress video about twice as high as Moving Picture Experts Group 2 (MPEG-2) and about one and a half times as high as MPEG-4 by using such technique as intra prediction encoding, ¼-pixel based variable block motion prediction and compensation, Context-based Adaptive Variable Length Coding (CAVLC), and Context-based Adaptive Binary Arithmetic Coding (CABAC).

The H.264/AVC standard predicts pixel values of a current block by using prediction modes of 9 directivities.

FIG. 1 illustrates 9 prediction modes used for intra prediction of 4×4 blocks.

As illustrated in FIG. 1, the 9 prediction modes used for intra prediction of 4×4 blocks include a vertical mode (mode 0), a horizontal mode (mode 1), a direct current (DC) mode (mode 2), a diagonal_down_left mode (mode 3), a diagonal_down_right mode (mode 4), a vertical_right mode (mode 5), a horizontal_down mode (mode 6), a vertical_left mode (mode 7), and a horizontal_up mode (mode 8).

Herein, in the DC mode (mode 2), intra prediction is performed using a mean value of adjacent pixels. The arrows indicate prediction directions.

Meanwhile, intra 16×16 prediction encoding includes a total of four modes, which are a vertical mode, a horizontal mode, a DC mode, and a plane mode.

Also, intra 8×8 prediction encoding includes a total of 9 modes, just like the intra 4×4 prediction encoding. As for color difference signals, intra 8×8 prediction encoding is performed, and the intra 8×8 prediction encoding includes a DC mode, a vertical mode, a horizontal mode, and a plane mode and so on.

Hereinafter, prediction methods in the vertical and horizontal modes for intra prediction of 4×4 blocks will be described with reference to FIGS. 2 and 3.

FIG. 2 exemplarily illustrates a pixel prediction method in a vertical direction in a 4×4 block 200.

As shown in FIG. 2, pixel a 201, pixel e 202, pixel i 203, and pixel m 204 are predicted based on an adjacent pixel A in the vertical direction.

Also, pixels b, f, j and b are predicted based on an adjacent pixel B in the vertical direction, and pixels c, g, k and o are predicted based on an adjacent pixel C in the vertical direction. Pixels d, h, l and p are predicted based on an adjacent pixel D in the vertical direction.

FIG. 3 exemplarily illustrates a pixel prediction method in a horizontal direction in a 4×4 block 200.

As illustrated in FIG. 3, pixel a 205, pixel b 206, pixel c 207, and pixel d 208 are predicted based on an adjacent pixel l in a horizontal direction.

Also, pixels e, f, g and h are predicted based on an adjacent pixel J in the horizontal direction, and pixels i, j, k and l are predicted based on an adjacent pixel K in the horizontal direction. Pixels m, n, o and p are predicted based on an adjacent pixel L in the horizontal direction.

An encoder performs Discrete Cosine Transform (DCT) and quantization onto residual signals (which are of a pixel area) acquired by calculating differences between the predicted pixels and the current pixels. Subsequently, the encoder performs zigzag scanning and entropy encoding onto the transformed coefficients obtained from DCT and quantization.

Herein, although the zigzag scanning takes advantage of an energy compaction characteristic of a transformed coefficient that energy converges into low frequency components and energy appears little in high frequency components, the energy compaction after intra prediction is not always effective.

In short, the zigzag scanning is a method of scanning a transformed coefficient from low frequency components to high frequency components. When distribution of transformed coefficients appears more in the low frequency components, the zigzag scanning is effective. However, when spatial prediction having directivity is used, the distribution of transformed coefficients is influenced by the direction of prediction. Therefore, it is ineffective to apply the zigzag scanning to the prediction of all directions.

DISCLOSURE Technical Problem

An embodiment of the present invention, which is devised to overcome the above problems, is directed to providing an encoding/decoding apparatus and method which performs intra prediction onto input video, predicts pixel similarity based on pixel similarity information of coefficients to be encoded acquired from adjacent pixels in the intra-predicted video, and performs a most effective scanning, e.g., DCT coefficient scanning, according to the predicted pixel similarity.

Other objects and advantages of the present invention can be understood by the following description, and become apparent with reference to the embodiments of the present invention. Also, it is obvious to those skilled in the art of the present invention that the objects and advantages of the present invention can be realized by the means as claimed and combinations thereof.

Technical Solution

In accordance with an aspect of the present invention, there is provided an encoding apparatus using a Discrete Cosine Transform (DCT) scanning, which includes a mode selection means for selecting an optimal mode for intra prediction; an intra prediction means for performing intra prediction onto video inputted based on the mode selected in the mode selection means; a DCT and quantization means for performing DCT and quantization onto residual coefficients of a block outputted from the intra prediction means; and an entropy encoding means for performing entropy encoding onto DCT coefficients acquired from the DCT and quantization by using a scanning mode decided based on pixel similarity of the residual coefficients.

In accordance with another aspect of the present invention, there is provided a decoding apparatus using a DCT scanning, which includes an entropy decoding means for performing entropy decoding onto encoded video; a scanning decision means for deciding a scanning mode for the video decoded in the entropy decoding means; and a video recovery means for recovering the video based on the scanning mode decided in the scanning decision means.

In accordance with another aspect of the present invention, there is provided an encoding method using a DCT scanning, which includes the steps of selecting an optimal mode for intra prediction; performing intra prediction onto video inputted based on the mode selected in the mode selection step; performing DCT and quantization onto residual coefficients of a block outputted from the intra prediction step; deciding pixel similarity of the residual coefficients; and performing entropy encoding onto DCT coefficients acquired from the DCT and quantization by using a scanning mode decided in the pixel similarity decision step.

In accordance with an aspect of the present invention, there is provided a decoding method using a DCT scanning, which includes the steps of performing entropy decoding onto encoded video; deciding a scanning mode for the video decoded in the entropy decoding step; and recovering the video based on the scanning mode decided in the scanning decision step.

According to an embodiment of the present invention, a luminance block may go through an intra 4×4 luminance encoding mode of H.264/Advanced Video Coding (AVC), which includes a vertical mode, a horizontal mode, a diagonal_down_left mode, a diagonal_down_right mode, a vertical_right mode, a horizontal_down mode, a vertical_left mode, and a horizontal_up mode, and an intra 16×16 luminance encoding mode of H.264/AVC, which includes a vertical mode, a horizontal mode, a plane mode, and a DC mode.

Also, according to an embodiment of the present invention, a chrominance block may go through an intra M×N chrominance encoding mode of H.264/AVC, which includes a vertical mode, a horizontal mode, a plane mode and a DC mode.

Advantageous Effects

As described above, the present invention can improve a compression rate of intra encoding by applying a most effective scanning method according to pixel similarity in order to encode/decode video.

Also, the present invention can improve a video compression rate by being applied to a video compression technology using intra prediction, which will be developed in the future.

Also, the present invention can reduce a need for an additional module by applying the same similarity information to both encoder and decoder.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates 9 prediction modes used for intra prediction of 4×4 blocks according to H.264/AVC.

FIG. 2 exemplarily illustrates a pixel prediction method in a vertical direction.

FIG. 3 exemplarily illustrates a pixel prediction method in a horizontal direction.

FIG. 4 is a block view showing an encoding apparatus using an adaptive DCT coefficient scanning based on pixel similarity in accordance with an embodiment of the present invention.

FIG. 5 exemplarily illustrates a zigzag scanning method used in the present invention.

FIG. 6 exemplarily illustrates a horizontal scanning method used in the present invention.

FIG. 7 exemplarily illustrates a vertical scanning method used in the present invention.

FIG. 8 illustrates a method for predicting pixel similarity in vertical and horizontal directions in accordance with an embodiment of the present invention.

FIG. 9 is a flowchart describing an adaptive scanning method based on pixel similarity in a vertical intra prediction mode in accordance with an embodiment of the present invention.

FIG. 10 is a flowchart describing an adaptive scanning method based on pixel similarity in a horizontal intra prediction mode in accordance with an embodiment of the present invention.

FIG. 11 is a block view showing a decoding apparatus using an adaptive DCT coefficient scanning based on pixel similarity in accordance with an embodiment of the present invention.

BEST MODE FOR THE INVENTION

The advantages, features and aspects of the invention will become apparent from the following description of the embodiments with reference to the accompanying drawings, which is set forth hereinafter. When it is considered that detailed description on a related art may obscure a point of the present invention, the description will not be provided herein. Hereinafter, specific embodiments of the present invention will be described in detail with reference to the accompanying drawings.

FIG. 4 is a block view showing an encoding apparatus using an adaptive DCT coefficient scanning based on pixel similarity in accordance with an embodiment of the present invention.

As illustrated in FIG. 4, the encoding apparatus based on DCT coefficient scanning adaptive to pixel similarity includes a mode selection unit 10, an intra prediction unit 20, a DCT and quantization unit 30, and an entropy encoding unit 40.

The mode selection unit 10 selects an optimal mode among several available prediction modes for intra prediction. In other words, it selects one among a plurality of possible encoding modes when 4×4, 16×16, or 8×8 intra prediction is performed. Generally, the mode selection unit 10 selects one mode according to a rate-distortion optimization method for reducing an amount of distortion at a given bit rate.

The intra prediction unit 20 receives a video, and performs 4×4 intra prediction for pixels of luminance blocks and 8×8 intra prediction for pixels of chrominance blocks based on a mode selected in the mode selection unit 10.

The DCT and quantization unit 30 performs DCT and quantization onto difference values outputted from the mode selection unit 10, that is, onto residual coefficient blocks indicating differences between pixel values of macro blocks of a current frame to be encoded and predicted pixel values, and transmits resulting coefficients to the entropy encoding unit 40.

The entropy encoding unit 40 arrays DCT coefficients obtained in the DCT and quantization unit 30 by using an adaptive DCT coefficient scanning based on pixel similarity, performs entropy encoding onto the arrayed DCT coefficients, and outputs an encoded video bitstream in accordance with the result.

Herein, the entropy encoding is an encoding technique for enhancing a compression rate by allocating a few bits to data highly likely to occur and many bits to data that are not likely to occur. Examples of the entropy encoding used in the present invention include Context-based Adaptive Variable Length Coding (CAVLC) or Context-based Adaptive Binary Arithmetic Coding (CABAC).

With reference to FIGS. 8 to 10, described hereafter are a method of predicting pixel similarity in vertical and horizontal directions in the entropy encoding unit 40, and a scanning method in vertical and horizontal intra prediction modes.

FIG. 5 exemplarily illustrates a typical zigzag scanning method used in the present invention. FIG. 6 exemplarily illustrates a typical horizontal scanning method used in the present invention. FIG. 7 exemplarily illustrates a typical vertical scanning method used in the present invention.

As shown in FIG. 5, the zigzag scanning method used in the present invention is devised in consideration that low frequency components of transformed coefficients acquired from the DCT and quantization are highly likely to be positioned in the upper left part of a two-dimensional plane. It takes advantage of a transformed coefficient energy compaction characteristic that coefficients after DCT collectively appear in low frequencies, whereas coefficients after DCT less appear in high frequencies.

The zigzag scanning method may be more efficient when pixel similarity in the horizontal direction is similar to the pixel similarity in the vertical direction.

However, when intra prediction encoding, particularly, vertical or horizontal intra prediction, is performed, the similarity of the residual coefficients in the vertical direction shows much difference from the similarity in the horizontal direction. Thus, the above-described coefficient distribution is not always effective. Therefore, it is inefficient to apply the zigzag scanning to prediction of all directions.

To describe an example of the vertical prediction mode, the vertical prediction mode is selected as an optimal mode in a rate-distortion optimization process, when the pixel similarity in the vertical direction is high. Herein, significant coefficients are distributed in the first row. Therefore, the horizontal scanning shown in FIG. 6 is more efficient than the typical zigzag scanning.

Meanwhile, to describe an example of the horizontal prediction mode, the horizontal prediction mode is selected as an optimal mode, when the pixel similarity in the horizontal direction is high. Herein, significant coefficients are distributed in the first column. Therefore, the vertical scanning shown in FIG. 7 is more efficient.

However, since the pixel similarity before intra prediction is different from pixel similarity of residual coefficients after the intra prediction, it is inefficient to simply use the scanning method of FIG. 6 or FIG. 7 according to the intra prediction mode.

Therefore, if pixel similarities in the vertical and horizontal directions of a block to be encoded are predicted based on similarity information among adjacent block boundary pixels which are already recovered and an adaptive scanning method according to the prediction result is used, the encoding efficiency can be increased.

FIG. 8 illustrates a method for predicting pixel similarity in vertical and horizontal directions in accordance with an embodiment of the present invention.

As illustrated in FIG. 8, pixels A, B, C and D are positioned adjacent to the upper part of a current block to be encoded, whereas pixels E, F, G and H are positioned adjacent to the left part of the current block to be encoded.

Herein, when vertical prediction encoding is performed, the vertical-directional pixel similarity of the pixels a, e, i and m in the first column of the current block to be encoded is the same as the vertical-directional pixel similarity of residual coefficients a-A, e-A, i-A, and m-A after vertical prediction. This is because the residual coefficients a-A, e-A, i-A, and m-A are differentiated by the same prediction pixel A from the pixels a, e, i and m, and thus the correlation does not change.

Also, the vertical-directional pixel similarity of the pixels in columns 2, 3 and 4 of the current block to be encoded is the same as the vertical-directional pixel similarity of residual coefficients after vertical prediction.

However, the horizontal-directional pixel similarity of the pixels a, b, c and d in the first row of the current block to be encoded is different from the horizontal-directional pixel similarity of residual coefficients a-A, b-B, c-C, and d-D after vertical prediction. Also, the horizontal-directional pixel similarity before vertical prediction is higher than the horizontal-directional pixel similarity after the vertical prediction. Thus, it becomes similar to or higher than the vertical-directional pixel similarity.

Likewise, in the case of the horizontal prediction encoding, the horizontal-directional pixel similarity of the pixels a, b, c and d in the first row of the current block to be encoded is the same as the horizontal-directional pixel similarity of residual coefficients a-E, b-E, c-E, and d-E after horizontal prediction. Also, the horizontal-directional pixel similarity of the pixels in rows 2, 3 and 4 of the current block to be encoded is the same as the horizontal-directional pixel similarity of the residual coefficients after horizontal prediction.

However, the vertical-directional pixel similarity of the pixels a, e, i and m in the first column of the current block to be encoded is different from the vertical-directional pixel similarity of residual coefficients a-E, e-F, i-G, and m-H after horizontal prediction. Also, the vertical-directional pixel similarity before horizontal prediction is higher than the vertical-directional pixel similarity after the horizontal prediction. Thus, it becomes similar to or higher than the horizontal-directional pixel similarity.

As described above, when the pixel similarities in the vertical and horizontal directions are similar, a general zigzag scanning method is more efficient than the horizontal and vertical scanning methods.

Therefore, when the vertical intra prediction mode is performed and the vertical-directional pixel similarity of residual coefficients is high and their horizontal-directional pixel similarity is low, it is more efficient to use the horizontal scanning.

Meanwhile, when the horizontal intra prediction mode is performed and the horizontal-directional pixel similarity of residual coefficients is high and their vertical-directional pixel similarity is low, it is more efficient to use the vertical scanning.

When the vertical-directional pixel similarity of recovered 8 pixels A, B, C, D, E, F, G and H of FIG. 8 is referred to as S_VER and their horizontal-directional pixel similarity is referred to as S_HOR, the pixel similarities for increasing the efficiency of 4×4 prediction encoding can be calculated using the following Equation 1.

$\begin{matrix} {{{S\_ VER} = \frac{1}{{Variance}\left( {E,F,G,H} \right)}}{{S\_ HOR} = \frac{1}{{Variance}\left( {A,B,C,D} \right)}}} & {{Equation}\mspace{14mu} 1} \end{matrix}$

In Equation 1, Variance( )denotes a dispersion; E, F, G and H denote pixels adjacent to the left part of the current block to be encoded; and A, B, C and D denote pixels adjacent to the upper part of the current block to be encoded.

When the vertical prediction mode is carried out, a value obtained by multiplying S_HOR by a multiplication factor α (α≧1) is used as a horizontal-directional pixel similarity prediction value of residual coefficients of the current block. Herein, the α value is fixed at 2 in an experiment. The S_VER as it is is used as a vertical-directional pixel similarity prediction value of the residual coefficients of the current block.

When the horizontal prediction mode is carried out, a value obtained by multiplying S_VER by a multiplication factor β (β≧1) is used as a vertical-directional pixel similarity prediction value of the residual coefficients of the current block. Herein, the β value is fixed at 2 in an experiment. The S_HOR as it is is used as a horizontal-directional pixel similarity prediction value of the residual coefficients of the current block.

The vertical-directional and horizontal-directional pixel similarity prediction values acquired in the above methods are compared to each other to decide a scanning method.

Although a 4×4 intra prediction mode is described in the above example, the present invention is not limited to the 4×4 intra prediction mode, and the present invention can be applied to an M×N intra prediction mode, too.

Hereinafter, a method of selecting a scanning method in the vertical and horizontal intra prediction modes will be described in detail with reference to FIGS. 9 and 10.

FIG. 9 is a flowchart describing an adaptive scanning method based on pixel similarity in a vertical intra prediction mode in accordance with an embodiment of the present invention.

In case of a vertical intra prediction mode in step S601, an S_VER value and a value of α×S_HOR are compared in step S602. When the S_VER value is greater than the value of α×S_HOR, a horizontal scanning method is used in step S603. When the S_VER value is smaller than the value of α×S_HOR, a zigzag scanning method is used in step S604.

Herein, when a vertical-directional pixel similarity of the current block to be encoded based on similarity of adjacent pixels is predicted higher than the horizontal-directional pixel similarity thereof, transformed coefficients obtained after DCT and quantization are highly likely to be distributed in a direction horizontal to a first row of the block. Therefore, the horizontal scanning method can bring about a high encoding efficiency.

FIG. 10 is a flowchart describing an adaptive scanning method based on pixel similarity in a horizontal intra prediction mode in accordance with an embodiment of the present invention.

In case of a horizontal intra prediction mode in step S701, an S_HOR value and a value of β×S_VER are compared in step S702. When the S_HOR value is greater than the value of β×S_VER, a vertical scanning method is used in step S703. When the S_HOR value is smaller than the value of β×S_VER, a zigzag scanning method is used in step S704.

Herein, when a horizontal-directional pixel similarity of the current block to be encoded based on similarity of adjacent pixels is predicted higher than the vertical-directional pixel similarity thereof, transformed coefficients obtained after DCT and quantization are highly likely to be disposed in a direction vertical to a first row of the block. Therefore, the vertical scanning method can bring about a high encoding efficiency.

FIG. 11 is a block view showing a decoding apparatus using an adaptive DCT coefficient scanning based on pixel similarity in accordance with an embodiment of the present invention.

As shown in FIG. 11, the decoding apparatus using an adaptive DCT coefficient scanning based on pixel similarity includes an entropy decoding unit 50, a scanning decision unit 60, and a video recovery unit 70.

The entropy decoding unit 50 receives an encoded video bitstream encoded in the encoding apparatus of FIG. 4 using an adaptive DCT coefficient scanning based on pixel similarity and decodes it through an entropy decoding method such as CAVLC or CABAC. Then, the entropy decoding unit 50 transmits the entropy-decoded video bitstream to the scanning decision unit 60.

The scanning decision unit 60 decides a scanning method for the coefficients decoded in the entropy decoding unit 50 according to an intra prediction mode, as described in the above with reference to FIGS. 8 to 11.

The video recovery unit 70 finally recovers the coefficients by using the scanning method decided in the scanning decision unit 60 to recover the video.

An experiment was carried out for diverse test videos using Joint Model 86 (JM86), which is an H.264/AVC Reference Codec, according to the above-described methods. The result of an increase in compression efficiency was as follows. In the experiment, videos recommended by H.264/AVC as test videos were used. The following Table 1 shows conditions of the experiment.

TABLE 1 News Container Coast Paris Coast Video (QCIF) (QCIF) (QCIF) (QCIF) (CIF) Entire 300 300 300 300 300 Frame (30 Hz) (30 Hz) (30 Hz) (35 Hz) (30 Hz) Conditions CAVLC, Intra only, QP(18, 22, 26, 30), rate-distortion optimization

As shown in Table 1, five test videos with different sizes were used for the experiment.

The following Table 2 presents video compression rates when the test videos were compressed using a conventional compression method, which is a zigzag scanning method of H.264/AVC, and the compression method of the present invention, which is the adaptive scanning method according to intra prediction mode under the same conditions as the Table 1.

TABLE 2 Method of the Present Bit H.264/AVC Invention Saving PSNR Bit rate PSNR Bit rate rate Sequence QP (dB) (Kbps) (dB) (Kbps) (%) News 18 45.64 2370.65 45.64 2344.75 1.51% (QCIF) 22 43.06 1714.99 43.05 1692.69 1.67% 26 40.32 1221.96 40.32 1206.02 1.51% 30 37.50 872.65 37.49 860.23 1.49% Container 18 44.84 874.63 44.84 857.75 1.93% (QCIF) 22 41.71 643.42 41.7 630.5 2.01% 26 38.61 451.07 38.61 441.54 2.11% 30 35.77 317.36 35.76 309.93 2.34% Coast 18 44.18 2200.99 44.13 2152.15 2.22% (QCIF) 22 40.61 1631.56 40.59 1592.37 2.40% 26 37.13 1139.76 37.12 111.02 2.52% 30 34.00 765.52 33.99 746.77 2.45% Paris 18 44.72 4360.41 44.71 4271.09 2.05% (CIF) 22 41.57 3334.22 41.56 3259.84 2.23% 26 38.25 2450.69 38.24 2391.77 2.40% 30 35.04 1780.73 35.03 1736.21 2.50% (Coast) 18 44.34 4068.4 44.33 4015.7 1.30% (CIF) 22 40.8 2989.5 40.8 2950.65 1.30% 26 37.32 2074.47 37.32 2045.89 1.38% 30 34.21 1388.07 34.22 1369.23 1.36%

The Table 2 shows that the result of video compression using the adaptive scanning method according to the intra prediction mode, which is suggested in the present invention, is superior to that of video compression using only the conventional zigzag scanning method of H.264/AVC.

The method of the present invention described above may be realized as a program and stored in a computer-readable recording medium such as a CD-ROM, RAM, ROM, floppy disks, hard disks, magneto-optical disks and so forth. Since the program can be easily implemented by those skilled in the art to which the present invention pertains, further description of the program will not be provided herein.

While the present invention has been described with respect to certain preferred embodiments, it will be apparent to those skilled in the art that various changes and modifications may be made without departing from the scope of the invention as defined in the following claims. 

What is claimed is:
 1. A decoding method comprising: performing entropy decoding of encoded video information to obtain transform coefficients; selecting a scanning mode for the transform coefficients; and scanning the transform coefficients based on the selected scanning mode; wherein the selecting of a scanning mode comprises selecting the scanning mode based on an intra prediction mode used to obtain difference values between pixel values and predicted pixel values.
 2. The decoding method of claim 1, wherein the selecting of the scanning mode based on an intra prediction mode comprises: selecting a horizontal scanning mode in response to the intra prediction mode being a vertical intra prediction mode; and selecting a vertical scanning mode in response to the intra prediction mode being a horizontal intra prediction mode. 